package vip.ola.service.dao.mapper.code;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import vip.ola.core.common.vo.DrawPassageVO;
import vip.ola.core.entity.code.CodeUser;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;


/**
 * <p>
 * 码商用户表 Mapper 接口
 * </p>
 *
 * @author faker
 * @since 2020-03-25
 */
public interface CodeUserMapper extends BaseMapper<CodeUser> {

    int insertSelective(CodeUser record);

    IPage<CodeUser> list(Page page, @Param("user") CodeUser codeUser);

    Map count(Page page, @Param("user") CodeUser codeUser);

    CodeUser getByCodeUser(@Param("user") CodeUser codeUser);

    CodeUser findByName(String username);

    int addCollAmount(@Param("userId") Long userId, @Param("amount") BigDecimal amount, @Param("profit") BigDecimal profit);

    List<Map> getByUserType(@Param("type") int type, @Param("codeBusId") Long codeBusId);

    int updateUserAgentRate(@Param("agentId") long agentId, @Param("rate") BigDecimal rate);

    int updateUserBusRate(@Param("codeBusId") long codeBusId, @Param("rate") BigDecimal rate);

    int frozenAmount(@Param("userId") long userId, @Param("amount") BigDecimal amount);

    int updateSettAmount(@Param("userId") long userId, @Param("settStatus") int settStatus, @Param("amount") BigDecimal amount);

    List<DrawPassageVO> getByPassageIds(@Param("idList") List idList);

    int updateAmountById(CodeUser user);
}
